var i;
Object.defineProperty(exports, "__esModule", {
  value: true
});
var AudioManager = require("AA_AudioManager");
var EventManager = require("AA_EventManager");
var TipsManager = require("AA_TipsManager");
var ResKeeper = require("AA_ResKeeper");
var AIControl = require("AA_AIControl");
var EvenType = require("AA_EvenType");
var PlayerDataManager = require("AA_PlayerDataManager");
var Const_Common = require("AA_Const_Common");
var GuideShou = require("AA_GuideShou");
var GameDataManager = require("AA_GameDataManager");
var _decorator = cc._decorator;
var _ccclass = _decorator.ccclass;
var _property = _decorator.property;
var _def_GuideMask = function (e) {
  function _creator() {
    var t = null !== e && e.apply(this, arguments) || this;
    t.MaskNode = null;
    t.mengBanBtn = null;
    t.shouZhiNode = null;
    t.btnNode = null;
    t.sayNode = null;
    t.sayLabel = null;
    t.tipNode = null;
    t.sanJiaoNode = null;
    t.blockNode = null;
    t.breakeBtn = null;
    t.isTweenTime = true;
    t.alwaysShow = false;
    return t;
  }
  __extends(_creator, e);
  _creator.prototype.onLoad = function () {
    var e = this;
    this.btnNode.on(cc.Node.EventType.TOUCH_START, function () {
      AudioManager.AudioMgr.playEffect("audio/effect/button");
    }, this);
    this.btnNode.on(cc.Node.EventType.TOUCH_END, function () {
      if (!e.isTweenTime) {
        e.alwaysShow || (e.node.active = false);
        e.callBack && e.callBack();
      }
    }, this);
    this.mengBanBtn.node.on("click", this.onClick, this);
    this.tipNode.runAction(cc.repeatForever(cc.sequence(cc.scaleTo(.7, 1.1, 1.1), cc.scaleTo(.7, 1, 1))));
    this.sanJiaoNode.runAction(cc.repeatForever(cc.sequence(cc.moveTo(.5, this.sanJiaoNode.x, this.sanJiaoNode.y + 15), cc.moveTo(.5, this.sanJiaoNode.x, this.sanJiaoNode.y))));
    this.breakeBtn.on(cc.Node.EventType.TOUCH_END, function () {
      PlayerDataManager.PlayerDataMgr.SetGuideIndex(Const_Common.GuideName.战斗背包, Const_Common.GameBagGuideIndex.引导完结);
      PlayerDataManager.PlayerDataMgr.SetGuideIndex(Const_Common.GuideName.仓库升级, Const_Common.UpEquipLevelGuideIndex.引导完结);
      GameDataManager.GameDataMgr.updateCiTiao(1, null);
      GameDataManager.GameDataMgr.ClearGameBagData();
      EventManager.EventMgr.dispatchEvent(EvenType.EVENT_TYPE.GAME_BackHall);
      e.node.active = false;
    }, this);
  };
  _creator.prototype.onClick = function () {
    TipsManager.TipMgr.showToast("请先跟随手指指引操作");
  };
  _creator.prototype.StartSet = function (e) {
    this.breakeBtn.active = false;
    PlayerDataManager.PlayerDataMgr.GetGuideIndexByTaskName(Const_Common.GuideName.战斗背包) != Const_Common.GameBagGuideIndex.引导完结 && (PlayerDataManager.PlayerDataMgr.WHITE_NAME_NO_VIDEO || cc.sys.isBrowser) && (this.breakeBtn.active = true);
    this.blockNode.active = true;
    var t = this;
    function o() {
      t.blockNode.active = false;
      t.isTweenTime = false;
      t.shouZhiNode.active = !e.isHideBtn;
      e.isHideBtn || t.shouZhiNode.getComponent(GuideShou.default).StartSet(true);
      t.shouZhiNode.setPosition(t.MaskNode.getPosition());
      t.btnNode.active = !e.isHideBtn;
      t.btnNode.setPosition(t.MaskNode.getPosition());
      if (e.btnIsMax) {
        t.btnNode.width = 2e3;
        t.btnNode.height = 3e3;
      } else {
        t.btnNode.width = e.size.width;
        t.btnNode.height = e.size.height;
      }
      AIControl.default._instance.isOpen && AIControl.default._instance.ShowClickBtn(t.btnNode, function () {
        t.alwaysShow || (t.node.active = false);
        t.callBack && t.callBack();
      });
    }
    this.callBack = e.callBack;
    this.shouZhiNode.active = false;
    this.sayNode.active = null != e.sayStr;
    this.sayLabel.string = e.sayStr;
    this.alwaysShow = e.alwaysShow || false;
    this.tipNode.active = e.showTipNode;
    if (e.sayNodePos) {
      this.sayNode.setPosition(e.sayNodePos);
      if (!e.noMaskTween) {
        this.sayNode.scale = 0;
        this.sayNode.runAction(cc.scaleTo(.5, 1, 1));
      }
    } else {
      this.sayNode.setPosition(0, 0);
    }
    this.btnNode.active = false;
    this.isTweenTime = true;
    if (e.size) {
      this.MaskNode.setPosition(this.node.convertToNodeSpaceAR(e.wPos));
      this.MaskNode.width = 1e3;
      this.MaskNode.height = 1700;
      cc.Tween.stopAllByTarget(this.MaskNode);
      if (e.noMaskTween) {
        this.MaskNode.width = e.size.width;
        this.MaskNode.height = e.size.height;
        o();
      } else {
        cc.tween(this.MaskNode).to(.5, {
          width: e.size.width,
          height: e.size.height
        }).call(function () {
          o();
        }).start();
      }
    } else {
      this.MaskNode.width = 0;
      this.MaskNode.height = 0;
      this.MaskNode.setPosition(0, 0);
      this.isTweenTime = false;
      this.btnNode.width = 1e3;
      this.btnNode.height = 1700;
      this.btnNode.setPosition(0, 0);
      t.btnNode.active = !e.isHideBtn;
      t.blockNode.active = false;
    }
  };
  __decorate([_property(cc.Node)], _creator.prototype, "MaskNode", undefined);
  __decorate([_property(cc.Button)], _creator.prototype, "mengBanBtn", undefined);
  __decorate([_property(cc.Node)], _creator.prototype, "shouZhiNode", undefined);
  __decorate([_property(cc.Node)], _creator.prototype, "btnNode", undefined);
  __decorate([_property(cc.Node)], _creator.prototype, "sayNode", undefined);
  __decorate([_property(cc.Label)], _creator.prototype, "sayLabel", undefined);
  __decorate([_property(cc.Node)], _creator.prototype, "tipNode", undefined);
  __decorate([_property(cc.Node)], _creator.prototype, "sanJiaoNode", undefined);
  __decorate([_property(cc.Node)], _creator.prototype, "blockNode", undefined);
  __decorate([_property(cc.Node)], _creator.prototype, "breakeBtn", undefined);
  return __decorate([_ccclass], _creator);
}(ResKeeper.default);
exports.default = _def_GuideMask;